<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>WebOJ Python 调试器</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/theme/monokai.min.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/mode/python/python.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js"></script>
</head>
<body>
    <div class="container">
        <header>
            <h1>🐍 WebOJ Python 调试器</h1>
            <div class="header-controls">
                <button id="loadExample" class="btn btn-secondary">加载示例</button>
                <button id="clearCode" class="btn btn-secondary">清空代码</button>
            </div>
        </header>

        <div class="main-content">
            <!-- 左侧：代码编辑器 -->
            <div class="left-panel">
                <div class="panel-header">
                    <h3>代码编辑器</h3>
                    <div class="line-info">
                        <span id="currentLineInfo">当前行: 未开始</span>
                    </div>
                </div>
                <div class="code-editor-container">
                    <textarea id="codeEditor" placeholder="在这里输入你的Python代码..."></textarea>
                </div>
                
                <!-- 调试控制面板 -->
                <div class="debug-controls">
                    <button id="startDebug" class="btn btn-primary">🚀 开始调试</button>
                    <button id="stepBtn" class="btn btn-success" disabled>👣 单步执行</button>
                    <button id="continueBtn" class="btn btn-info" disabled>▶️ 继续执行</button>
                    <button id="stopDebug" class="btn btn-danger" disabled>⏹️ 停止调试</button>
                </div>
            </div>

            <!-- 右侧：调试信息面板 -->
            <div class="right-panel">
                <!-- 变量查看器 -->
                <div class="variables-panel">
                    <div class="panel-header">
                        <h3>🔍 变量查看器</h3>
                        <button id="refreshVars" class="btn btn-sm">刷新</button>
                    </div>
                    <div id="variablesContainer" class="variables-container">
                        <p class="no-data">暂无变量信息</p>
                    </div>
                </div>

                <!-- 断点管理 -->
                <div class="breakpoints-panel">
                    <div class="panel-header">
                        <h3>🔴 断点管理</h3>
                        <div class="breakpoint-controls">
                            <input type="number" id="breakpointLine" placeholder="行号" min="1">
                            <button id="addBreakpoint" class="btn btn-sm">添加</button>
                        </div>
                    </div>
                    <div id="breakpointsContainer" class="breakpoints-container">
                        <p class="no-data">暂无断点</p>
                    </div>
                </div>

                <!-- 输出面板 -->
                <div class="output-panel">
                    <div class="panel-header">
                        <h3>📄 输出</h3>
                        <button id="clearOutput" class="btn btn-sm">清空</button>
                    </div>
                    <div class="output-tabs">
                        <button class="tab-btn active" data-tab="output">标准输出</button>
                        <button class="tab-btn" data-tab="errors">错误信息</button>
                    </div>
                    <div id="outputContainer" class="output-container">
                        <div id="outputContent" class="tab-content active"></div>
                        <div id="errorsContent" class="tab-content"></div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 状态栏 -->
        <div class="status-bar">
            <span id="connectionStatus">🔴 未连接</span>
            <span id="debugStatus">调试器未启动</span>
        </div>
    </div>

    <!-- 消息提示 -->
    <div id="messageContainer" class="message-container"></div>

    <script src="{{ url_for('static', filename='script.js') }}"></script>
</body>
</html> 